package com.example.retrofitinterface;

import com.example.bean.Result;
import com.example.okhttp.RHandler;
import com.example.okhttp.RHandler2;
import com.okhttp.annotations.ApiGenerateService;
import com.okhttp.annotations.ApiResponseHandler;
import com.okhttp.retrofit.BaseResponseBodyHandler;
import java.util.Map;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.Field;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PartMap;
import retrofit2.http.Url;

/**
 * @author YLG
 * @Datetime 2020/5/12-9:27 PM
 * @Version v1.0
 * @description
 */
@ApiGenerateService(BaseResponseBodyHandler.class)
public interface Net5 {

  /**
   * 上传文件请求
   * @param url URL路径
   * @param paramMap 请求参数
   */
  @Multipart
  @POST
  Call<ResponseBody> postFile(@Url String url, @PartMap Map<String, RequestBody> paramMap);

  @ApiResponseHandler(
      handler = RHandler2.class
    ,isGenerate = false
  )
  @POST
  Call<Result<String>> post(@Field("url") String url,@Field("test")String test);


  @ApiResponseHandler(
      handler = RHandler.class,
      isSync = true
  )
  @POST
  Call<Result<String>> post2(@Field("url") String url,@Field("test")String test);

}
